<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ScreenMind 截屏助手</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            width: 350px;
            min-height: 400px;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: #ffffff;
            color: #333333;
            border: 1px solid #e0e0e0;
        }
        
        .header {
            padding: 20px;
            text-align: center;
            background: #f8f9fa;
            border-bottom: 1px solid #e0e0e0;
        }
        
        .header h1 {
            font-size: 18px;
            margin-bottom: 5px;
            color: #2c3e50;
        }
        
        .header p {
            font-size: 12px;
            color: #6c757d;
        }
        
        .content {
            padding: 20px;
        }
        
        .action-section {
            margin-bottom: 25px;
        }
        
        .capture-btn {
            width: 100%;
            padding: 15px;
            background: #007bff;
            border: 1px solid #007bff;
            border-radius: 6px;
            color: white;
            font-size: 16px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
        }
        
        .capture-btn:hover {
            background: #0056b3;
            border-color: #0056b3;
        }
        
        .capture-btn:active {
            background: #004085;
        }
        
        .capture-btn:disabled {
            background: #6c757d;
            border-color: #6c757d;
            cursor: not-allowed;
        }
        
        .shortcut-info {
            background: #f8f9fa;
            padding: 15px;
            border-radius: 6px;
            margin-bottom: 20px;
            border: 1px solid #e9ecef;
        }
        
        .shortcut-info h3 {
            font-size: 14px;
            margin-bottom: 8px;
            color: #495057;
        }
        
        .shortcut-key {
            background: #e9ecef;
            padding: 4px 8px;
            border-radius: 4px;
            font-family: monospace;
            font-size: 12px;
            color: #495057;
        }
        
        .status-section {
            margin-bottom: 20px;
        }
        
        .status-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 10px 0;
            border-bottom: 1px solid #e9ecef;
        }
        
        .status-item:last-child {
            border-bottom: none;
        }
        
        .status-label {
            font-size: 13px;
            color: #6c757d;
        }
        
        .status-value {
            font-size: 12px;
            background: #e9ecef;
            padding: 4px 8px;
            border-radius: 4px;
            color: #495057;
        }
        
        .result-section {
            background: #f8f9fa;
            border-radius: 6px;
            padding: 15px;
            margin-bottom: 20px;
            display: none;
            border: 1px solid #e9ecef;
        }
        
        .result-section.show {
            display: block;
        }
        
        .result-title {
            font-size: 14px;
            font-weight: 500;
            margin-bottom: 10px;
            color: #495057;
        }
        
        .result-content {
            background: #ffffff;
            color: #333;
            padding: 12px;
            border-radius: 4px;
            font-size: 13px;
            line-height: 1.5;
            max-height: 150px;
            overflow-y: auto;
            border: 1px solid #dee2e6;
        }
        
        .settings-section {
            margin-top: 20px;
        }
        
        .setting-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 10px 0;
        }
        
        .setting-label {
            font-size: 13px;
            color: #495057;
        }
        
        .toggle-switch {
            position: relative;
            width: 40px;
            height: 20px;
            background: #dee2e6;
            border-radius: 10px;
            cursor: pointer;
            transition: background 0.3s;
        }
        
        .toggle-switch.active {
            background: #007bff;
        }
        
        .toggle-switch::after {
            content: '';
            position: absolute;
            top: 2px;
            left: 2px;
            width: 16px;
            height: 16px;
            background: white;
            border-radius: 50%;
            transition: transform 0.3s;
        }
        
        .toggle-switch.active::after {
            transform: translateX(20px);
        }
        
        .footer {
            padding: 15px 20px;
            text-align: center;
            font-size: 11px;
            color: #6c757d;
            border-top: 1px solid #e9ecef;
            background: #f8f9fa;
        }
        
        .loading {
            display: inline-block;
            width: 16px;
            height: 16px;
            border: 2px solid #dee2e6;
            border-radius: 50%;
            border-top-color: #007bff;
            animation: spin 1s ease-in-out infinite;
        }
        
        @keyframes spin {
            to { transform: rotate(360deg); }
        }
    </style>
</head>
<body>
    <div class="header">
        <h1>🤖 ScreenMind</h1>
        <p>智能截屏分析助手</p>
    </div>
    
    <div class="content">
        <div class="action-section">
            <button id="captureBtn" class="capture-btn">
                <span id="captureIcon">📸</span>
                <span id="captureText">开始截屏分析</span>
            </button>
        </div>
        
        <div class="shortcut-info">
            <h3>⚡ 快捷键</h3>
            <p>按 <span class="shortcut-key">Cmd+Shift+S</span> 在任何网页快速截屏</p>
        </div>
        
        <div class="status-section">
            <div class="status-item">
                <span class="status-label">服务器状态</span>
                <span id="serverStatus" class="status-value">检查中...</span>
            </div>
            <div class="status-item">
                <span class="status-label">最后截屏</span>
                <span id="lastCapture" class="status-value">无</span>
            </div>
        </div>
        
        <div id="resultSection" class="result-section">
            <div class="result-title">📝 最新分析结果</div>
            <div id="resultContent" class="result-content"></div>
        </div>
        
        <div class="settings-section">
            <div class="setting-item">
                <span class="setting-label">自动分析</span>
                <div id="autoAnalyzeToggle" class="toggle-switch active"></div>
            </div>
            <div class="setting-item">
                <span class="setting-label">显示通知</span>
                <div id="notificationToggle" class="toggle-switch active"></div>
            </div>
        </div>
    </div>
    
    <div class="footer">
        ScreenMind v1.0.0 | 作者: CZL | AI驱动的智能助手
    </div>
    
    <script src="popup.js"></script>
</body>
</html>